package chat.server.statemachine.identity;

import java.util.ArrayList;
import java.util.Set;

import chat.statemachine.AbstractContent;

/**
 * This class represent the response to a IdentityAskContent
 * Contain :
 * - iam : who I am
 * - neighbors : collection of Integer of my neighbors
 * @author Baptiste Lafontaine
 * @author Arsène Huot
 *
 */
public class IdentityContent extends AbstractContent {
	private static final long serialVersionUID = 867890232129275140L;
	private int iam;
	private ArrayList<Integer> neighbors;
	
	public IdentityContent(int iam) {
		this(iam, null);
	}
	
	public IdentityContent (int iam, Set<Integer> set) {
		neighbors = new ArrayList<Integer>();
		this.iam = iam;
		if (set != null ) { neighbors.addAll(set); }
	}
	
	/**
	 * Identity of the server sending the identityContent 
	 * @return 
	 */
	public int getIam() {
		return iam;
	}
	
	/**
	 * Get list of identity of neighbors of IAM server
	 * @return
	 */
	public ArrayList<Integer> getNeighbors() {
		return this.neighbors;
	}
}
